Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Graphics /
Chapter 4 - Geometric Operations / Geometric Operations Reference
Functions / Finding Geometric Information About Shapes


GXGetShapeLength

You can use the GXGetShapeLength function to determine the length of a particular contour or of all contours of a shape.

gxWide *GXGetShapeLength(gxShape source, long index, 
                         gxWide *length);
source
A reference to the shape containing the contour.
index
The index of the contour you want to measure. You may specify a value of 0 for this parameter to measure all contours.
length
A pointer to a gxWide value. On return, this value indicates the length of the indicated contour.
function result
The length of the indicated contour.
DESCRIPTION
The GXGetShapeLength function returns as the function result the length of the perimeter of a particular contour of a shape. This function calculates the length of the contour as defined in the shape's geometry; it does not consider transformations to the shape made by the shape's transform.

For empty and full shapes, this function posts the warning shape_does_not_have_length. For point shapes, it returns zero. For solid polygon and path shapes, this function calculates the length as if the shape had the closed-frame shape fill.

If you provide a target shape that is not one of the geometric shape types, this function performs the actions described in the following table:
Shape typeAction taken
bitmapPosts the warning shape_does_not_have_length
pictureReturns the length of the specified picture item or the sum of the length of all picture items
textPosts the warning shape_does_not_have_length
glyphPosts the warning shape_does_not_have_length
layoutPosts the warning shape_does_not_have_length

ERRORS, WARNINGS, AND NOTICES
Errors 
out_of_memory 
shape_is_nil 
parameter_is_nil(debugging version)
contour_is_less_than_zero(debugging version)
Warnings 
contour_out_of_range 
shape_does_not_have_length(debugging version)
unable_to_traverse_open_contour_that_starts_or_ends_off_the_curve
 (debugging version)
SEE ALSO
For an example using this function, see "Finding the Length of a Contour" beginning on page 4-42.

For information about the contours of the various geometric shapes, see Chapter 2, "Geometric Shapes," in this book.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help